﻿
using Zy.Shared.Enums;
using Zy.Shared.Rpc.GrpcBase;

namespace Zy.Shared.Rpc.GrpcClientServices.User
{
    /// <summary>
    /// 用户服务
    /// </summary>
    /// <param name="config"></param>
    public class UserGrpcClientService(UserGrpc.UserGrpcClient client): IGrpcBaseClientService
    {
        /// <summary>
        /// 查询用户信息
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public Task<UserInfoRto> GetUserInfoAsync(long userId)
        {
            var reply = client.GetUserInfo(new GetUserGrpcRequest()
            {
                Id = userId
            });
            return Task.FromResult(new UserInfoRto()
            {
                Id = reply.Id,
                Name = reply.Name,
                Sex = reply.Sex,
                Phone = reply.Phone,
                Email = reply.Email,
                Address = reply.Address,
                Account = reply.Account,
                DataScope = (DataScopeEnum)reply.DataScope,
                Photo = reply.Photo,
                UserIdCard = reply.UserIdCard,
            });
        }
    }
}
